<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<title>
			X-admin v1.0
		</title>
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="format-detection" content="telephone=no">
		<link rel="stylesheet" href="./css/x-admin.css" media="all">
		<link href="css/xtiper.css" type="text/css" rel="stylesheet" />
		<script src="js/xtiper.min.js" type="text/javascript"></script>
		<script type="text/javascript" src="js/rmodal.js"></script>
		<script src="./lib/layui/layui.js" charset="utf-8"></script>
		<script src="./js/x-layui.js" charset="utf-8"></script>
		<script src="js/jquery.min.js"></script>
	</head>

	<body onload="findall()">
		<div class="x-nav">
			<span class="layui-breadcrumb">
              <a><cite>首页</cite></a>
              <a><cite>用户管理</cite></a>
              <a><cite>用户列表</cite></a>
            </span>
			<a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href);" title="刷新"><i class="layui-icon" style="line-height:30px">ဂ</i></a>
		</div>
		<div class="x-body">
			<div style="margin-bottom: 15px;">
						<label class="layui-form-label">查询用户</label>
						<div class="layui-input-inline">
							<input type="text" id="customerNumber" name="customerNumber" placeholder="用户手机号" autocomplete="off" class="layui-input">
						</div>
						<div class="layui-input-inline" style="width:80px" >
							<button class="layui-btn" onclick="search()"><i class="layui-icon">&#xe615;</i></button>
						</div>
				</div>
			<table class="layui-table">
				<thead>
					<tr>
						<th>
							<input type="checkbox" name="" value="">
						</th>
						<th>
							ID
						</th>
						<th>
							登录手机
						</th>
						<th>
							地址
						</th>
						<th>
							登录名称
						</th>
						<th>
							时间
						</th>
						
					</tr>
				</thead>
				<tbody id="userslist">

				</tbody>
			</table>
			
		</div>
		<script src="./lib/layui/layui.js" charset="utf-8"></script>
		<script src="./js/x-layui.js" charset="utf-8"></script>

		<script type="text/javascript">
			function findall() {
				var settings = {
					"url": "http://127.0.0.1:8080/customer/findall1",
					"method": "GET",
					"timeout": 0,
					"headers": {
						"Content-Type": "application/json"
					},
				};
				$.ajax(settings).done(function(response) {
					var msg = "";
					var a = 1;
					for(var i = 0; i < response.length; i++) {
						msg += '<tr> <td>';
						msg += '<input type=\"checkbox\" value=\"' + response[i].customerId + '\" id=\"commentId\" name=\"commentId\"></td> ';
						msg += '<td>' + a + '</td> ';
						msg += '<td>' + response[i].customerNumber + '</td>';
						msg += '<td>' + response[i].customerLocation + '</td>';
						msg += '<td>' + response[i].customerName + '</td>';
						msg += '<td>' + response[i].customerDate + '</td></tr>';
						a++;
					}
					$("#userslist").html(msg);
				});
			}
		</script>
		
		<script type="text/javascript">
				function search() {
					var customerNumber = $("#customerNumber").val();
					var url = 'http://127.0.0.1:8080/customer/findCustomer1?customerNumber='+customerNumber;
					var settings = {
						"url": url,
						"method": "POST",
						"timeout": 0,
						"headers": {
							"Content-Type": "application/json"
						}
					};
					$.ajax(settings).done(function (response) {
						$("#userslist").empty();
						var msg = "";
						msg += '<tr> <td>';
						msg += '<input type=\"checkbox\" value=\"' + response.customerId + '\" id=\"commentId\" name=\"commentId\"></td> ';
						msg += '<td>' + 1+ '</td> ';
						msg += '<td>' + response.customerNumber + '</td>';
						msg += '<td>' + response.customerLocation + '</td>';
						msg += '<td>' + response.customerName + '</td>';
						msg += '<td>' + response.customerDate + '</td></tr>';
						$("#userslist").html(msg);
				})
				}
			</script>
	</body>

</html>